<?php
namespace app\index\controller;
use app\model\Order as OrderModel;
use think\Db;


class Order extends Base
{
    public function __construct(){
        $model = new OrderModel();
        $this->model = $model;
        parent::__construct();
        
        $page_info = $this->page_info;
        $page_info['title'] = '产品';

        $this->assign([
            'model'=>$this->model,
            'page_info'=>$page_info
        ]);
    }

    public function detail($id){
        $data = OrderModel::where('id',$id)->find();
        if (!empty($data)) {
            OrderModel::where('id',$id)->inc('view_num')->update();
        }
        return view('detail', [
            'data'=>$data
        ]);
    }

    public function index(){
        $model = $this->model;
        $map_params = [
            
        ];
        $map = getSearchParam($map_params);
      
        $page_param = [
            'page'=>input('page',1),
            'list_rows'=>input('page_size',999999)
        ];
        $list = $model->where($map)->order('ctime','desc')->paginate($page_param);
        $page = $list->render();
        $page = indexPage($page);

        $list = $list->toarray();
        return view('index', [
            'list'=>$list,
            'page'=>$page
        ]);
    }

    public function zszsm(){
        return view('zszsm', [
           
        ]);
    }


    
}
